package cn.javass.dp.command.example5;

import java.util.ArrayList;
import java.util.Collection;

/**
 * 菜单
 */
public class MenuCommand implements Command{

    private Collection<Command> commands = new ArrayList<>();

    public Collection<Command> getCommands() {
        return commands;
    }

    public void addCommand(Command cmd) {
        commands.add(cmd);
    }


    //宏命令
    @Override
    public void execute() {
        for (Command command : commands) {
            command.execute();
        }
    }
}
